<form name="frmSearchCtvProduct" id="frmSearchCtvProduct" onsubmit="AdminController.searchCtvProduct(0,1); return false;">
    <div class="search_product">
    <ul class="list_item_search">
        <li>
            Tháng
        </li>
        <li>
            <select name="customer_product_month_process" id="customer_product_month_process" class="w100p">
                <option value="">Chọn tháng</option>
                <option value="1">Tháng 1</option>
                <option value="2">Tháng 2</option>
                <option value="3">Tháng 3</option>
                <option value="4">Tháng 4</option>
                <option value="5">Tháng 5</option>
                <option value="6">Tháng 6</option>
                <option value="7">Tháng 7</option>
                <option value="8">Tháng 8</option>
                <option value="9">Tháng 9</option>
                <option value="10">Tháng 10</option>
                <option value="11">Tháng 11</option>
                <option value="12">Tháng 12</option>
            </select>
        </li>
        <li>Năm</li>
        <li>
            <select name="customer_product_year_process" id="customer_product_year_process" class="w100p">
                <option value="">Chọn năm</option>
                <option value="2011">2011</option>
                <option value="2012">2012</option>
                <option value="2013">2013</option>
            </select>
        <li>Kinh doanh</li>
        <li>
            <select name="customer_product_kd_id" id="customer_product_kd_id" class="w200p">
                <option value="0">Chọn kinh doanh</option>
                <?php foreach ($aryMemberKd as $key => $value) {?>
                <option value="<?php echo $value['member_id'];?>" <?php echo ($memberId == $value['member_id']) ? 'selected' : '';?>><?php echo $value['member_full_name'];?></option>
                <?php } ?>
            </select>
        </li>
        <li>Cộng Tác Viên</li>
        <li>
            <select class="w150p" name="customer_product_customer_id" id="customer_product_customer_id">
                <option value="0">Chọn công tác viên</option>
                <?php foreach ($aryCustomerCtv as $key => $value) {?>
                <option value="<?php echo $value['customer_id'];?>"><?php echo $value['customer_full_name'];?></option>
                <?php } ?>
            </select>
        </li>
        <li>
            <input type="submit" class="submit" value="Tìm kiếm">
        </li>
    </ul>
</div>
</form>

<div style="height: 20px;"></div>
<div id="list_statistics_ctv">
<table cellpadding="0" cellspacing="0" width="100%" align="left" class="table-list">
    <col width="50%">
    <col width="50%">
    <?php foreach ($aryCtv as $key => $value) {?>
        <tr class="<?php echo ($key % 2 == 0) ? 'alt' : '' ?>">
            <td>
                <ul class="ul-list-order">
                    <li class="list-order-header">Họ tên</li>
                    <li class="list-order-detail"><?php echo $value['customer_full_name'];?></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Ngày sinh</li>
                    <li class="list-order-detail"><?php echo date("d/m/Y", strtotime($value['customer_date_birthday']));?></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Địa chỉ</li>
                    <li class="list-order-detail"><?php echo $value['customer_address'];?></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Điện thoại di động</li>
                    <li class="list-order-detail"><?php echo $value['customer_mobile_phone'];?></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Điện thoại bàn</li>
                    <li class="list-order-detail"><?php echo $value['customer_home_phone'];?></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Email</li>
                    <li class="list-order-detail"><?php echo $value['customer_email'];?></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Yahoo</li>
                    <li class="list-order-detail"><a href="ymsgr:sendIM?<?php echo $value['customer_yahoo']; ?>"><img border="0" align="absmiddle" src="http://opi.yahoo.com/online?u=<?php echo $value['customer_yahoo']; ?>&amp;m=g&amp;t=1"></a></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Skype</li>
                    <li class="list-order-detail"><a href="skype:<?php echo $value['customer_skype']; ?>?chat"><img src="http://mystatus.skype.com/smallicon/<?php echo $value['customer_skype']; ?>"></a></li>
                </ul>
                <ul class="ul-list-order">
                    <li class="list-order-header">Ngày tham gia</li>
                    <li class="list-order-detail"><?php echo date("d/m/Y", strtotime($value['customer_join_date']));?></li>
                </ul>
            </td>
            <td>
                <ul class="ul-list-order">
                    <li class="list-order-product-header w200p">
                        Tổng sản phẩm
                        <div class="list_item_ctv">
                            Đã chốt:
                            <?php foreach ($aryCtvTotalProfit as $key3 => $ctvProfit) {?>
                                <?php if($ctvProfit['customer_statistics_cus_id'] == $value['customer_id']) {?>
                                    <?php echo $ctvProfit['customer_statistics_total_product'];?>
                                <?php } ?>
                            <?php } ?>
                        </div>
                        <div class="list_item_ctv">
                            Trong tháng <?php echo $month;?>/<?php echo $year;?>:
                            <?php foreach ($aryTotalCustomerProduct as $key2 => $product) {?>
                                <?php if($key2 == $value['customer_id']) {?>
                                    <span style="color: red;"><?php echo (isset ($product['customer_total_product'])) ? $product['customer_total_product'] : 0;?></span>
                                <?php } ?>
                            <?php } ?>
                            <div style="padding-left: 10px;">
                                Đã chốt:&nbsp;
                                <?php foreach ($aryTotalProduct as $key4 => $product) {?>
                                <?php if($key4 == $value['customer_id']) {?>
                                    <?php echo (isset ($product['customer_total_product'])) ? $product['customer_total_product'] : 0;?>
                                <?php } ?>
                                <?php } ?>
                            </div>
                            <div style="padding-left: 10px;">
                                Chưa chốt:&nbsp;
                                <?php foreach ($aryCurrentProduct as $key4 => $product) {?>
                                <?php if($key4 == $value['customer_id']) {?>
                                <span style="color: red;"><?php echo (isset ($product['customer_total_product'])) ? $product['customer_total_product'] : 0;?></span>
                                <?php } ?>
                                <?php } ?>
                            </div>
                        </div>
                        <div style="font-weight: bold;">
                            Tổng lợi nhuận
                        </div>
                        <div class="list_item_ctv">
                            Đã chốt:&nbsp;<?php foreach ($aryCtvTotalProfit as $key3 => $ctvProfit) {?>
                                <?php if($ctvProfit['customer_statistics_cus_id'] == $value['customer_id']) {?>
                                    <?php echo number_format($ctvProfit['customer_statistics_total_profit'], 0, ',', '.'); ?>&nbsp;VNĐ
                                <?php } ?>
                            <?php } ?>
                        </div>
                        <div class="list_item_ctv">
                            Trong tháng <?php echo $month;?>/<?php echo $year;?>
                            <div>
                                <?php foreach ($aryTotalCustomerProduct as $key2 => $product) {?>
                                <?php if($key2 == $value['customer_id']) {?>
                                <span style="color: red;"><?php echo number_format($product['customer_product_ctv_profit'], 0, ',', '.'); ?>&nbsp;VNĐ</span>
                                <?php } ?>
                            <?php } ?>
                            </div>
                            <div style="padding-left: 10px;">
                                Đã chốt:&nbsp;
                                <?php foreach ($aryTotalProduct as $key4 => $product) {?>
                                <?php if($key4 == $value['customer_id']) {?>
                                    <?php echo (isset ($product['customer_product_ctv_profit'])) ? number_format($product['customer_product_ctv_profit'], 0, ',', '.') : 0;?>
                                <?php } ?>
                                <?php } ?>
                            </div>
                            <div style="padding-left: 10px;">
                                Chưa chốt:&nbsp;
                                <?php foreach ($aryCurrentProduct as $key4 => $product) {?>
                                <?php if($key4 == $value['customer_id']) {?>
                                <span style="color: red;"><?php echo (isset ($product['customer_product_ctv_profit'])) ? number_format($product['customer_product_ctv_profit'], 0, ',', '.') : 0;?>&nbsp;VNĐ</span>
                                <?php } ?>
                                <?php } ?>
                            </div>
                            
                        </div>

                    </li>
                    <li class="list-order-product-header">
                        Người phụ trách
                        <div class="list_item_ctv">
                            <?php foreach ($aryMemberKd as $key2 => $kd) {?>
                                <?php if($kd['member_id'] == $value['customer_of_member_id']) {?>
                                    <?php echo $kd['member_login_name'];?>
                                <?php } ?>
                            <?php } ?>
                        </div>
                    </li>
                </ul>

            </td>
        </tr>
        <tr class="<?php echo ($key % 2 == 0) ? 'alt' : '' ?>">
            <td colspan="2" align="right">
                <span><a class="cpointer" onclick="AdminController.viewDetailSearchDoanhSo(<?php echo $value['customer_id'];?>)">Xem chi tiết</a></span>
            </td>
        </tr>
    <?php } ?>

</table>
<div class="clear"></div>
<div align="right"><?php echo $strPaging; ?></div>
</div>
